package z.t.b.db.meta;

/**
 * xx
 *
 * @Description TODO
 * @Author ztb
 * @Date 2024/3/23 16:51
 * @Version 1.0
 */
public class Column {

    private String name;
    private String type;
    private String isNull;
    private String defaultValue;
    private String comment;
    private String extra;

    private Table owner;

    public Column(Table owner) {
        this.owner = owner;
    }

    public Table getOwner() {
        return owner;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIsNull() {
        return isNull;
    }

    public void setIsNull(String isNull) {
        this.isNull = isNull;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getExtra() {
        return extra;
    }

    public void setExtra(String extra) {
        this.extra = extra;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Column column = (Column) o;

        if (name != null ? !name.equals(column.name) : column.name != null) {
            return false;
        }
        if (type != null ? !type.equals(column.type) : column.type != null) {
            return false;
        }
        if (isNull != null ? !isNull.equals(column.isNull) : column.isNull != null) {
            return false;
        }
        if (defaultValue != null ? !defaultValue.equals(column.defaultValue) : column.defaultValue != null) {
            return false;
        }
        // 注释、自增暂时干掉
        /*if (comment != null ? !comment.equals(column.comment) : column.comment != null) {
            return false;
        }
        return extra != null ? extra.equals(column.extra) : column.extra == null;*/
        return true;
    }
}
